package com.bw.mapper;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface Vomapper {
@Select("select  '运输次数' name ,count(id) 'value' from transport_task where date(create_time)='2023-01-06'\n" +
        "union\n" +
        "select  '运输里程' name ,sum(actual_distance) 'value' from transport_task where date(create_time)='2023-01-06'\n" +
        "union\n" +
        "select  '运输时长' name ,sum(timestampdiff(second,actual_start_time,actual_end_time)) 'value'  from transport_task where date(create_time)='2023-01-06'")
    List<Vo> getlist1();
@Select("select count(*) from order_info where date(create_time)='2023-01-06'")
    Double getlist2();
@Select("select bo.org_name 'name',sum(tt.actual_distance) 'num',\n" +
        "       count(tt.id) 'ci',sum(timestampdiff(second,actual_start_time,actual_end_time)) 'num2',\n" +
        "       sum(timestampdiff(second,actual_start_time,actual_end_time))/count(tt.id) 'avgtime',\n" +
        "       sum(tt.actual_distance)/ count(tt.id) 'avg'\n" +
        "from transport_task tt\n" +
        "left join line_base_info lbi on tt.line_id = lbi.id\n" +
        "left join base_organ bo on bo.id = lbi.org_id\n" +
        "group by bo.org_name")
    List<Vo1> getlist3();
@Select("select  b.name ,count(*) 'value' from express_task_delivery ex\n" +
        "left join base_organ bo on bo.id = ex.org_id\n" +
        "left join base_region_info bri on bo.region_id = bri.id\n" +
        "left join base_region_info b on b.id = bri.parent_id\n" +
        "group by b.name")
    List<Vo> getlist4();
}
